Skip to content

[video_player] Fix video player plugin freeze issue #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 2, 2021

Conversation

xiaowei-guan
Copy link
Contributor

When flutter engine upgrade to 2.5.1, only call mark frame available
API can triggle previous frame destruction callback.
#250

@xiaowei-guan xiaowei-guan requested a review from a team October 29, 2021 08:45
When flutter engine upgrade to 2.5.1, only call mark frame available
API can triggle previous frame destruction callback.
@swift-kim
Copy link
Member

I tested the example app on a watch 5.5 emulator and a watch 5.5 device, but flickering occurred frequently during video play and empty frames were displayed when the video was paused. Is this a known issue? The same thing occurs on a mobile 6.0 emulator so maybe it's not an Evas GL renderer-specific issue.

Copy link
Contributor

@bbrto21 bbrto21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several errors occur playing video, but the video is played well on TM1

E/ConsoleMessage(19508): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(player_set_playback_rate failed, Function not implemented, null, null)
E/ConsoleMessage(19508): #0      VideoPlayerApi.setPlaybackSpeed (package:video_player_platform_interface/messages.dart:290:7)
E/ConsoleMessage(19508): <asynchronous suspension>
E/ConsoleMessage(19508): #1      VideoPlayerController._applyPlaybackSpeed (package:video_player/video_player.dart:495:5)
E/ConsoleMessage(19508): <asynchronous suspension>
E/ConsoleMessage(19508): #2      VideoPlayerController._applyPlayPause (package:video_player/video_player.dart:471:7)
E/ConsoleMessage(19508): <asynchronous suspension>
E/ConsoleMessage(19508): #3      VideoPlayerController.play (package:video_player/video_player.dart:422:5)
E/ConsoleMessage(19508): <asynchronous suspension>
E/ConsoleMessage(19508): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Null check operator used on a null value
E/ConsoleMessage(19508): #0      VideoPlayerController.initialize.errorListener (package:video_player/video_player.dart:381:51)
E/ConsoleMessage(19508): #1      _rootRunUnary (dart:async/zone.dart:1436:47)
E/ConsoleMessage(19508): #2      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/ConsoleMessage(19508): #3      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/ConsoleMessage(19508): #4      _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:362:15)
E/ConsoleMessage(19508): #5      _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:378:7)
E/ConsoleMessage(19508): #6      _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:280:7)
E/ConsoleMessage(19508): #7      _ForwardingStreamSubscription._addError (dart:async/stream_pipe.dart:128:11)
E/ConsoleMessage(19508): #8      _ForwardingStream._handleError (dart:async/stream_pipe.dart:95:10)
E/ConsoleMessage(19508): #9      _ForwardingStreamSubscription._handleError (dart:async/stream_pipe.dart:157:13)
E/ConsoleMessage(19508): #10     _rootRunBinary (dart:async/zone.dart:1452:47)
E/ConsoleMessage(19508): #11     _CustomZone.runBinary (dart:async/zone.dart:1342:19)
E/ConsoleMessage(19508): #12     _
E/ConsoleMessage(19508): CustomZone.runBinaryGuarded (dart:async/zone.dart:1252:7)
E/ConsoleMessage(19508): #13     _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:360:15)
E/ConsoleMessage(19508): #14     _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:378:7)
E/ConsoleMessage(19508): #15     _DelayedError.perform (dart:async/stream_impl.dart:602:14)
E/ConsoleMessage(19508): #16     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706:11)
E/ConsoleMessage(19508): #17     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:663:7)
E/ConsoleMessage(19508): #18     _rootRun (dart:async/zone.dart:1420:47)
E/ConsoleMessage(19508): #19     _CustomZone.run (dart:async/zone.dart:1328:19)
E/ConsoleMessage(19508): #20     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
E/ConsoleMessage(19508): #21     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
E/ConsoleMessage(19508): #22     _rootRun (dart:async/zone.dart:1428:13)
E/ConsoleMessage(19508): #23     _CustomZone.run (dart:async/zone.dart:1328:19)
E/ConsoleMessage(19508): #24     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
E/ConsoleMessage(19508): #25     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
E/ConsoleMessage(19508): #26     _microtaskLoop (dart:async/schedule_mic
E/ConsoleMessage(19508): rotask.dart:40:21)
E/ConsoleMessage(19508): #27     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)

@xiaowei-guan
Copy link
Contributor Author

I tested the example app on a watch 5.5 emulator and a watch 5.5 device, but flickering occurred frequently during video play and empty frames were displayed when the video was paused. Is this a known issue? The same thing occurs on a mobile 6.0 emulator so maybe it's not an Evas GL renderer-specific issue.

I run the app on the TV device, and can reproduce flickering issue.
I check the log and the engine code, I didn't consider that frame decode callback speed is faster than flutter rendder speed.

Copy link
Member

@bwikbs bwikbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's pretty cool~ thanks! :smil

Copy link
Member

@swift-kim swift-kim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flickering can still be observed on wearable emulator but probably it's out of scope of this PR. The limitation is already stated in #58 and we'll have to check that issue later. Thanks!

@xiaowei-guan
Copy link
Contributor Author

Several errors occur playing video, but the video is played well on TM1

E/ConsoleMessage(19508): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(player_set_playback_rate failed, Function not implemented, null, null)
E/ConsoleMessage(19508): #0      VideoPlayerApi.setPlaybackSpeed (package:video_player_platform_interface/messages.dart:290:7)
E/ConsoleMessage(19508): <asynchronous suspension>
E/ConsoleMessage(19508): #1      VideoPlayerController._applyPlaybackSpeed (package:video_player/video_player.dart:495:5)
E/ConsoleMessage(19508): <asynchronous suspension>
E/ConsoleMessage(19508): #2      VideoPlayerController._applyPlayPause (package:video_player/video_player.dart:471:7)
E/ConsoleMessage(19508): <asynchronous suspension>
E/ConsoleMessage(19508): #3      VideoPlayerController.play (package:video_player/video_player.dart:422:5)
E/ConsoleMessage(19508): <asynchronous suspension>
E/ConsoleMessage(19508): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Null check operator used on a null value
E/ConsoleMessage(19508): #0      VideoPlayerController.initialize.errorListener (package:video_player/video_player.dart:381:51)
E/ConsoleMessage(19508): #1      _rootRunUnary (dart:async/zone.dart:1436:47)
E/ConsoleMessage(19508): #2      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/ConsoleMessage(19508): #3      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/ConsoleMessage(19508): #4      _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:362:15)
E/ConsoleMessage(19508): #5      _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:378:7)
E/ConsoleMessage(19508): #6      _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:280:7)
E/ConsoleMessage(19508): #7      _ForwardingStreamSubscription._addError (dart:async/stream_pipe.dart:128:11)
E/ConsoleMessage(19508): #8      _ForwardingStream._handleError (dart:async/stream_pipe.dart:95:10)
E/ConsoleMessage(19508): #9      _ForwardingStreamSubscription._handleError (dart:async/stream_pipe.dart:157:13)
E/ConsoleMessage(19508): #10     _rootRunBinary (dart:async/zone.dart:1452:47)
E/ConsoleMessage(19508): #11     _CustomZone.runBinary (dart:async/zone.dart:1342:19)
E/ConsoleMessage(19508): #12     _
E/ConsoleMessage(19508): CustomZone.runBinaryGuarded (dart:async/zone.dart:1252:7)
E/ConsoleMessage(19508): #13     _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:360:15)
E/ConsoleMessage(19508): #14     _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:378:7)
E/ConsoleMessage(19508): #15     _DelayedError.perform (dart:async/stream_impl.dart:602:14)
E/ConsoleMessage(19508): #16     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706:11)
E/ConsoleMessage(19508): #17     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:663:7)
E/ConsoleMessage(19508): #18     _rootRun (dart:async/zone.dart:1420:47)
E/ConsoleMessage(19508): #19     _CustomZone.run (dart:async/zone.dart:1328:19)
E/ConsoleMessage(19508): #20     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
E/ConsoleMessage(19508): #21     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
E/ConsoleMessage(19508): #22     _rootRun (dart:async/zone.dart:1428:13)
E/ConsoleMessage(19508): #23     _CustomZone.run (dart:async/zone.dart:1328:19)
E/ConsoleMessage(19508): #24     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
E/ConsoleMessage(19508): #25     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
E/ConsoleMessage(19508): #26     _microtaskLoop (dart:async/schedule_mic
E/ConsoleMessage(19508): rotask.dart:40:21)
E/ConsoleMessage(19508): #27     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)

#261 This is another issue, I will fix it.

@bbrto21 bbrto21 merged commit 2095128 into flutter-tizen:master Nov 2, 2021
@swift-kim swift-kim changed the title Fix video player plugin freeze issue [video_player] Fix video player plugin freeze issue Dec 3, 2021
bwikbs pushed a commit to bwikbs/plugins that referenced this pull request Mar 26, 2022
* Fix video player plugin freeze issue

When flutter engine upgrade to 2.5.1, only call mark frame available
API can triggle previous frame destruction callback.

* Rename IsValidMediaPacket to isValidMediaPacket

* Rename using_media_packet_ to current_media_packet_

* Make isValidMediaPacket method name start with uppercase letter

* When frame decode callback speed is faster than flutter renderer
speed, skip old one and store new one.
@xiaowei-guan xiaowei-guan deleted the video_freeze_2 branch August 23, 2022 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants